<?php
$taskIds = $_GET['TaskId'] ?? null;
if (empty($taskIds)){
    echo "任务id错误";
    exit();
}

$dsn = "sqlsrv:Server=localhost;Database=Task";
$db = new PDO($dsn, "sa", "123456");

$deleteSql = "delete from Task where TaskId in (". implode("," , $taskIds) .") and TaskStatus = 1";
$result= $db ->exec($deleteSql);
if ($result){
    echo "删除成功<br/>";
    echo "<a href='task_list.php'>返回列表页面</a>";
} else{
    echo "删除失败<br/>";
    echo "<a href='javascript:history.go(-1)'>返回上一页</a>";
}